package com.cmbc.bean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author jianghaoqiang
 * @Date 2022/5/22
 * 5.通过FactoryBean来定义bean
 */
public class CreateByFactoryBeanTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext =new AnnotationConfigApplicationContext(Config2.class);

        Person user=applicationContext.getBean("user2",Person.class);

        System.out.println(user);
        FactoryBeanUser factoryBeanUser=applicationContext.getBean("&user2",FactoryBeanUser.class);
        System.out.println(factoryBeanUser);
    }
}
